import React,{Component} from 'react';
import BlackBorderContainer from './BlackBorderContainer'

export default class Clock extends Component{
    constructor(){
        super()
        this.state={
            date:new Date()
        }
    }

    componentWillMount(){
        // this.timer=setInterval(()=>{
        //     this.setState({
        //         date:new Date()
        //     })
        // },1000)
    }
    componentDidMount(){
        this.input.focus()
    }
    componentWillUnmount(){
        //clearInterval(this.timer)
    }
    render(){
        return (
            <dv>
                <input ref={(input)=>this.input=input} ></input>
                <div>
               <BlackBorderContainer>
               <div className='name'>My Name：Lucy</div>
                 <p className='age'>
                    My Age：<span>12</span>
                </p>
               </BlackBorderContainer>
                </div>
                <p>现在的时间是</p>
          {this.state.date.toLocaleTimeString()}
            </dv>
        )
    }
}